package com.majun.listener;

import com.majun.bean.MyMessage;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
// topic 主题要与消息生产者一致
@RocketMQMessageListener(consumerGroup = "consumer-group", topic = "add-bonus")
public class GeneralMsgListener implements RocketMQListener<MyMessage> {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public void onMessage(MyMessage testMessaging) {
        logger.warn("消费到消息 => " + testMessaging.toString());
    }
}
